From eea192adaa7e6ad535ae53a18a04685513eff673 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 21 Jan 2013 16:38:23 -0500 Subject: [PATCH] Sync from Nautilus commit 480b1daf8814063f348d0f75082353a2f6a3eab3 cancel the hostnamed proxy creation on dispose --- gtk/gtkplacessidebar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index f944fb7e16..40ab3e0cbc 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -152,6 +152,7 @@ struct _GtkPlacesSidebar { GSList *shortcuts; GDBusProxy *hostnamed_proxy; + GCancellable *hostnamed_cancellable; char *hostname; GtkPlacesOpenFlags open_flags; @@ -3226,6 +3227,8 @@ hostname_proxy_new_cb (GObject *source_object, GError *error = NULL; sidebar->hostnamed_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + g_clear_object (&sidebar->hostnamed_cancellable); + if (error != NULL) { g_debug ("Failed to create D-Bus proxy: %s", error->message); g_error_free (error); @@ -3504,13 +3507,14 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar) tree_view_set_activate_on_single_click (sidebar->tree_view); sidebar->hostname = g_strdup (_("Computer")); + sidebar->hostnamed_cancellable = g_cancellable_new (); g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES, NULL, "org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1", - NULL, + sidebar->hostnamed_cancellable, hostname_proxy_new_cb, sidebar); } @@ -3570,6 +3574,11 @@ gtk_places_sidebar_dispose (GObject *object) g_clear_object (&sidebar->volume_monitor); } + if (sidebar->hostnamed_cancellable != NULL) { + g_cancellable_cancel (sidebar->hostnamed_cancellable); + g_clear_object (&sidebar->hostnamed_cancellable); + } + g_clear_object (&sidebar->hostnamed_proxy); g_free (sidebar->hostname); sidebar->hostname = NULL; -- 2.30.2